package com.qf.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.mapper.DtsOrderMapper;
import com.qf.mapper.statMapper;
import com.qf.pojo.DtsOrder;
import com.qf.service.OrderService;
import com.qf.vo.CategorySellAmts;
import com.qf.vo.DayStatis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private DtsOrderMapper dtsOrderMapper;

    @Autowired
    private statMapper statMapper;

    @Override
    public int count() {

        QueryWrapper<DtsOrder> wrapper = new QueryWrapper<>();
        wrapper.eq("deleted", false);
        Integer count = dtsOrderMapper.selectCount(wrapper);
        return count;
    }

    /**
     * 类别销售额统计
     * @return
     */
    @Override
    public List<CategorySellAmts> categorySell() {
        return statMapper.categorySellStatis();
    }

    /**
     * 查找最近一段时间的订单增长量
     * @param statisDaysRang
     * @return
     */
    @Override
    public List<DayStatis> recentCount(int statisDaysRang) {
        return statMapper.statisIncreaseOrderCnt(statisDaysRang);
    }
}
